    
<? 
require_once 'includes/funciones.php';
include ("seguridad.php");
conexion();
?>
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title><?php titulo();?></title>
    <link rel="stylesheet" href="2col_rightNav.css" type="text/css" />
    <link type="text/css"  href="plugins/jq_ui/css/custom-theme/jquery-ui-1.8.14.custom.css" rel="stylesheet"/> 
    <script type="text/javascript" src="plugins/jq_ui/js/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="plugins/jq_ui/js/jquery-ui-1.8.10.custom.min.js"></script>
    <script type="text/javascript"  src="plugins/jq_ui/jquery.ui.datepicker-es.js"></script>

    <script  src="plugins/jq_ui/development-bundle/ui/jquery.ui.widget.js"></script>
    <script src="plugins/jq_ui/development-bundle/ui/jquery.ui.button.js"></script>
    
    <script type="text/javascript"  src="plugins/jquery_validate/jquery.validate.js"></script>
<script>
  $(document).ready(function(){
		
	$("#form1").validate({
		rules: {			
                     titulo: {
				required: true
				},

                     desc: {
                            required: true
                            },
			campofecha: {
				required: true
				
			},
                        tipo: {
				required: true
				                               
			},
                       subtipo: {
                            required: true
                                 },
			categoria: {
				required: true
                        },
                        
			org: {
				required: true
                        },
                        
			zip: {
				required: true
                        },
                        
			img: {
				required: true
                        },
			ver: {
				required: true
				
			}

		},
		messages: {
			titulo: {
				required: "*"
			},
                        desc: {
				required: "*"
			},
                        campofecha: {
                               required: "*"
                        },
                        tipo: {
				required: "*"
                                
			},
                        subtipo: {
				required: "*"
				
			},

			categoria: {
				required: "*"
				
			},
			org: {
				required: "*"
			
			}
                        ,
			zip: {
				required: "*"
			
			},
			img: {
				required: "*"
			
			},
			ver: {
				required: "*"
			
			}
			
			
		}
	});
	
  });
</script>
    
	
<script type="text/javascript">
$(function()
    {
	$( "#boton1" )
        	.button()
    })
</script>
<script language="JavaScript"  type="text/JavaScript">
    $(document).ready(function(){
        $("#tipo").change(function(event){
            var id = $("#tipo").find(':selected').val();
                $("#subtipo").load('selectsubtipo.php?var='+id);

        });

    });
</script>	

<script language="JavaScript"  type="text/JavaScript">
    $(document).ready(function(){
        $("#categoria").change(function(event){
            var id = $("#categoria").find(':selected').val();
                $("#subcategoria").load('selectsubcategoria.php?var='+id);

        });

    });
</script>

<script language="JavaScript"  type="text/JavaScript">
     $(document).ready(function(){
        $("#reg").change(function(event){
            var id = $("#reg").find(':selected').val();
                 $("#dpto").load('selectdpto.php?var='+id);
                 $("#dptoayuda").load('selectdptoayuda.php?var='+id);
		 $("#muni").load('selectmuni.php');
        });

    });

</script>
<script language="JavaScript"  type="text/JavaScript">
    $(document).ready(function(){
        $("#dpto").change(function(event){
            var a = '';
            var idm = $("#dpto").find(':selected').val();  
            $("#muni").load('selectmuni.php?var='+idm);
                 $("#dptoayuda").load('selectidptoayuda.php?var='+idm);
                 $("#reg").load('selectireg.php?var='+idm);
        });

    });

</script>

<script language="JavaScript"  type="text/JavaScript">
    $(document).ready(function(){
        $("#org").change(function(event){
            var id = $("#org").find(':selected').val();
                $("#area").load('selectarea.php?var='+id);

        });

    });
</script>
<script>
$(document).ready(function(){
   $("#campofecha").datepicker({
     /*showOn: 'both',
      buttonImage: 'calendar.png',
      buttonImageOnly: true,*/
      changeYear: true,
      onSelect: function(textoFecha, objDatepicker){
         $("#mensaje").html("<p>Has seleccionado: " + textoFecha + "</p>");
      }
   });
})
</script>

</head>
<!-- The structure of this file is exactly the same as 2col_leftNav.html;
     the only difference between the two is the stylesheet they use -->

<body>
    <div   class="supercontendeor">
 <div id="encabezado">
   	<?php
	require_once("encabezado.php");

	?> 
</div>
<!-- fin encabesado -->
<div id="content">
  <div id="breadCrumb"></div>
  <h2 id="pageName">Cargar capa </h2>
  <div class="feature">
    <form action="control_capas.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <table width="946" border="0">
      <tr>
        <td><label>
          <div align="right">Titulo 
            </label>
          </div></td>
        <td colspan="3"><label>
          <textarea name="titulo" id="titulo" cols="60"></textarea>
        </label></td>
        </tr>
      <tr>
        <td><label> 
          <div align="right">Descripción del autor
            </label> 
          </div></td>
        <td colspan="3"><label>
          <textarea name="desc" id ="desc" cols="60" rows="4"></textarea>
        </label></td>
        </tr>
      
        <?php
        if($usuario_grupo==1){                
        echo '
      <tr>
      <td><label> 
           <div align="right">Comentario Web Master
            </label> 
          </div></td>
        <td colspan="3"><label>
          <textarea name="coment" id= "coment"	 cols="60" rows="4"></textarea>
        </label></td>
        </tr>
      <tr>';}?>
        <td><label>
          <div align="right">Metadatos 
            </label> 
          </div></td>
        <td colspan="3"><label>
          <textarea name="metadatos" id="matadatos" cols="60" rows="4"></textarea>
        </label></td>
        </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Fecha de creación
            </label> 
          </div></td>
        <td colspan="2">  
            <input type="text" name="fecha" id="campofecha">  
            <span class="ayuda" style=" font-style:normal">(Fecha en la que la capo fue creada)     </span></td>
        <td></td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Tipo 
            </label> 
          </div></td>
        <td><label>
          <select name="tipo" id="tipo">
            <option value="">Seleccionar Tipo</option>
            <option value="Vectorial">Vectorial</option>
            <option value="Raster">Raster</option>
          </select>
        </label></td>
        <td width="231"></td>
        <td width="270"></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Subtipo 
            </label> 
          </div></td>
        <td><label>
          <select name="subtipo" id="subtipo">
            <option value="">Seleccionar Subtipo</option>
          </select>
        </label></td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Categoría 
            </label> 
          </div></td>
        <td><label>
          <select name="categoria" id="categoria">
            <option value="">Seleccionar Categoria</option>
			    <?php
                $concla= mysql_query("select c.id, c.nombre from samptyt.categoria1 as c;");
                while($rowconcla=mysql_fetch_array($concla))
                    {
                        echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['nombre'].' </option>';
                    }
                    ?>
          </select>
        </label></td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Subcategoríoa  
            </label>
          </div></td>
        <td><label>
          <select name="subcategoria" id="subcategoria">
            <option>Seleccionar Subcategoria</option>
          </select>
        </label></td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2" rowspan="6"><div id="dptoayuda"></div></td>
      </tr>
      <tr>
        <td width="146"><label>
          <div align="right">País
            </label>          
          </div></td>
        <td width="281"><select name="pais" id="pais">
          <?php
                $concla= mysql_query("select p.id,p.nombre from samptyt.pais as p;");
                while($rowconcla=mysql_fetch_array($concla))
                    {
                        echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['nombre'].' </option>';
                    }
                    ?>
        </select></td>
        </tr>
      <tr>
        <td><label>
          <div align="right">Provincia 
            </label>
          </div></td>
        <td><select name="prov" id="prov">
          <?php
                $concla= mysql_query("select p.id,p.nombre from samptyt.provincia as p;");
                while($rowconcla=mysql_fetch_array($concla))
                    {
                        echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['nombre'].' </option>';
                    }
                    ?>
        </select></td>
        </tr>
      <tr>
        <td><label>
          <div align="right">Región
            </label>
          </div></td>
        <td><select name="reg" id="reg">
          <option value ="">Selecione Region</option>
          <?php
                $concla= mysql_query("select r.id, r.nombre from samptyt.region as r;");
                while($rowconcla=mysql_fetch_array($concla))
                    {
                        echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['nombre'].' </option>';
                    }
                    ?>
        </select></td>
        </tr>
      <tr>
        <td><label>
          <div align="right">Departamento 
            </label>
          </div></td>
        <td><select name="dpto" id="dpto">
          <option value ="">Selecione Departamento</option>
          <?php
                $concla= mysql_query("select d.id,d.nombre from samptyt.departamento as d;");
                while($rowconcla=mysql_fetch_array($concla))
                    {
                        echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['nombre'].' </option>';
                    }
                    ?>
        </select></td>
        </tr>
      <tr>
        <td><label></label>
          <label> 
          <div align="right">Municipio 
            </label>
          </div></td>
        <td><select name="muni" id="muni">
          <option value ="">Selecione Municipio</option>
        </select></td>
        </tr>
      <tr>
        <td></td>
        <td></td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Organización</div>
          </label></td>
        <td><label>
          <select name="org" id="org">
            <option value ="">Seleccionar Organizacion</option>
			    <?php
				$concla= mysql_query("select o.id,o.nombre  from samptyt.organizacion as o;");
                while($rowconcla=mysql_fetch_array($concla))
                    {
                        echo '<option value="'.$rowconcla['id'].'">'.$rowconcla['nombre'].' </option>';
                    }
                    ?>
          </select>
        </label></td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td><label>
          <div align="right">Area</div>
        </label></td>
        <td><label>
          <select name="area" id= "area">
            <option>Seleccionar Area</option>
          </select>
        </label></td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td><label><div align="right">Autor</div></td></label>
           <td><input type="text" name="autor" id="autor"></td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td><label>
          <div align="right"> Archivo de Capa</div>
        </label> </td>
        <td colspan="3"><label>
          <input type="file" name="zip" id="zip">
        </label></td>
        </tr>
      <tr>
        <td><label>
          <div align="right"> Imagen ilustrativa</div>
          </label> </td>
        <td colspan="3"><label>
          <input type="file" name="img" id="img">
        </label></td>
        </tr>
      <tr>
        <td><label><div align="right">Verificados</div></label></td>
        <td><label>
          <select name="ver" id="ver">
            <option value="1">Si</option>
            <option value="0" selected>No</option>
          </select>
        </label></td>
        <td colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td align="right"><div align="right"><br>
        </div>          <label>
          <div align="right"></div>
          </label></td>
        <td><div align="center"><br><br>
            <input name="boton" type="hidden" id="boton" value="1"></input>
            <input id="boton1" type="submit" name="Submit" value="Guardar">        
        </div></td>
        <td colspan="2">&nbsp;</td>
      </tr>
    </table>
    <p>&nbsp;</p>
    </form>
    <div id= "resultados">
      
    </div>
    
    <p>
      <?php 


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
    </p>
    <p>&nbsp;</p>
  </div>
  <div class="story">
    <h3>&nbsp;</h3>
  </div>
  <div class="story"></div>
</div>
<!--end content -->
<div id="menuderecha">
     	<?php
	require_once("menuderecha.php");

	?> 
</div>
<!--fin menuderecha -->
<div id="footer">
     	<?php
	require_once("footer.php");

	?> 
</div>

<br />
    </div>
</body>
</html>